/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hate;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author martinLequerica
 */
public class Carteles {

    private JFrame jf;
    private LinkedList<JTextField> llt;
    private JButton aceptar;
    private JButton cancelar;

    public void ventanaIngreso(String[] etiquetas,final String [] result) {
        //variables
        llt = new LinkedList();
        aceptar= new JButton("Aceptar");       
        cancelar= new JButton("Cancelar");       
      
        //dimencion
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        
        
        jf = new JFrame();
        jf.setSize(307, 52*(etiquetas.length)+1);
        jf.setLocation(d.width/4, d.height/4);

        

        
        JPanel jp = new JPanel();
        jp.setLayout(new GridLayout(etiquetas.length+1, 2));
        
        
        
        
        
        for (int i = 0 ; i<etiquetas.length;i++){
            
            jp.add(new JLabel(etiquetas[i]));
            
            llt.add(new JTextField());
            jp.add(llt.get(i));
            
            
        }
        
        jp.add(aceptar);
        jp.add(cancelar);
        
        
        
        
     
        aceptar.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
           
                for (int i = 0 ; i< llt.size(); i++){
                    
                    result[i] = llt.get(i).getText();
                    
                    
                }
                
            }
        });

        jf.add(jp);
        jf.setVisible(true);

        
        
        



    }
}
